import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import * as path from "node:path";


// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  // 静态资源基础路径
  base: './',
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src'),
      '@images': path.resolve(__dirname, './src/assets/images')
    }
  },
  build: {
    // 资源输出目录
    assetsDir: 'static',

    // 资源大小限制（小于此值的图片将内联为base64）
    assetsInlineLimit: 4096, // 4KB

    // 输出文件名格式
    rollupOptions: {
      output: {
        assetFileNames: 'static/[name]-[hash][extname]',
        chunkFileNames: 'static/[name]-[hash].js',
        entryFileNames: 'static/[name]-[hash].js'
      }
    }
  }
})
